<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends BackController {
	public function index(){
		//使用C读取菜单栏
		$menu_data = C('MENU');
		$this->assign('menu_data',$menu_data);
        //获取登录信息
		$qe_user = session('qe_user');
            if(session('?qe_user')) {
                //实例化角色表
                $power = M('power');
                $role = $power->where('id='.$qe_user['pwdid'])->field('content')->find();
                $qe_user['content'] = json_decode($role['content'],true);
                $this->assign('qe_user',$qe_user);
            }
		$weekarray=array("日","一","二","三","四","五","六");
		$this->assign('week',"星期".$weekarray[date("w")]);
		$this->assign('time',date('Y-m-d', time()));
		//校长
		if((session('qe_user')['xid']!=0) and (session('qe_user')['pwdid']==7)){
			$where['xid'] = array('eq',session('qe_user')['xid'],'and');
		}elseif((session('qe_user')['xid']!=0) and (session('qe_user')['pwdid']!=7)){
			//销售
			$where['xsid'] = array('eq',session('qe_user')['id'],'and');
		}
		$where['state_id']  = array('not in',array('9','13'),'and');
		//回访时间搜索
		$where['record_time'] = array('eq',date("Y-m-d"),'and');
		$sc_student = M('sc_student');
		$count = $sc_student->where($where)->count();
		$this->assign('count',$count);
		$this->assign('sc_data',$sc_data);
		//print_r($menu_data);
		$this->display();
	}
	public function del(){
		if(IS_POST){
			$model = M(I('post.model'));
			$id = I('post.id');
			if($model->where('id='.$id)->delete()) {
					echo 1;
			}else {
					echo 0;
			}  
		}
	}
}